package com.test2015.Swing.jtreetable.ext;

public class MyTreeNode {
	private String[] colsName;
	private Class[] colsType;
	
	private MyTreeNode parent;
	private MyTreeNode[] childs;

	private Object[] colsValue;
	
	private String leafIconPath = null;
	private String parentIconPath = null;
	
	private int iconType = 0;
	
	public MyTreeNode(Object[] colsValue){
		this.colsValue = colsValue;
	}

	public MyTreeNode(String[] colsName2, Class[] colsType2, Object[] rootValue) {
		this.colsName = colsName2;
		this.colsType = colsType2;
		this.colsValue = rootValue;
	}

	public MyTreeNode[] getChilds() {
		return childs;
	}

	public void setChilds(MyTreeNode[] child) {
		this.childs = child;
	}

	public MyTreeNode getParent() {
		return parent;
	}

	public void setParent(MyTreeNode parent) {
		this.parent = parent;
	}

	public Object[] getColsValue() {
		return colsValue;
	}

	public void setColsValue(Object[] colsValue) {
		this.colsValue = colsValue;
	}
	
	public Object getValueByCol(int column){
		return colsValue[column];
	}

	public String[] getColsName() {
		return colsName;
	}

	public void setColsName(String[] colsName) {
		this.colsName = colsName;
	}

	public Class[] getColsType() {
		return colsType;
	}

	public void setColsType(Class[] colsType) {
		this.colsType = colsType;
	}
	
	public int getChildCount(){
		if(childs!=null){
			return childs.length;
		}
		return 0;
	}
	
	public String toString(){
		if(colsValue==null || colsValue.length ==0){
			return "";
		}
		return colsValue[0].toString();
	}

	public int getIconType() {
		return iconType;
	}

	public void setIconType(int iconType) {
		this.iconType = iconType;
	}
	
}
